<?php
/**
 * @revision      $Id: registry.php 7 2011-08-20 10:33:23Z agbiggora@gmail.com $
 * @created       Apr 22, 2011
 * @category      MongoWeb
 * @package       AG CMS
 * @version       1.0.0
 * @copyright     Copyright Alexey Gordeyev IK (c) 2009-2011 - All rights reserved.
 * @license       GNU Lesser GPL
 * @author        Alexey Gordeyev IK <aleksej@gordejev.lv>
 * @link          http://www.gordejev.lv/
 * @link          http://www.agjoomla.com/
 * @link          http://code.google.com/p/ag-cms/
 */

// No direct access
defined('_AGEXEC') or die;

/**
 * AG CMS Registry class
 * @since 1.0.0
 */
Class Registry
{
   /**
    * Basic cms variables
    * @var array
    */
   private $vars = array();

   /**
    * Set variable
    * @param  string $key
    * @param  mixed  $var
    * @return bool
    */
   function set($key, $var) {

      if (isset($this->vars[$key]) == true)
      {
         throw new Exception('Unable to set var `' . $key . '`. Already set.');
      }
      $this->vars[$key] = $var;

      return true;
   }
    
   /**
    * Get variable
    * @param  string $key
    * @return mixed
    */
   function get($key) {

      if (isset($this->vars[$key]) == false)
      {
         return null;
      }
      return $this->vars[$key];
   }
    
   /**
    * Remove variable
    * @param  string $key
    * @return mixed
    */
   function remove($key)
   {
      unset($this->vars[$key]);
   }
    
}

?>